package frmsystem.gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SpringLayout;


public class TransactionButtonPanel extends JPanel {
	
	protected JButton btnTransaction;
	protected JButton btnExit;
	protected BoxLayout layout;
	
	public TransactionButtonPanel(){
	}
	
	public TransactionButtonPanel(int width, int height){
		layout = new BoxLayout(this, BoxLayout.Y_AXIS);
		setLayout(layout);
		
		btnTransaction = new JButton("Transaction");
		add(btnTransaction);
		/*layout.putConstraint(SpringLayout.NORTH, btnTransaction, 10, SpringLayout.NORTH, this);
		layout.putConstraint(SpringLayout.WEST, btnTransaction, 10, SpringLayout.WEST, this);*/		
		
		btnExit = new JButton("Exit");
		add(btnExit);
		/*layout.putConstraint(SpringLayout.NORTH, btnExit, 10, SpringLayout.SOUTH, btnTransaction);
		layout.putConstraint(SpringLayout.WEST, btnExit, 0, SpringLayout.WEST, btnTransaction);*/
		setSize(new Dimension(width, height));
	}
	
	public void addTransactionListener(ActionListener al){
		btnTransaction.addActionListener(al);
	}
	
	public void addExitListener(ActionListener al){
		btnExit.addActionListener(al);
	}
	
	//Test main
	public static void main(String ar[]){
		JFrame frm = new JFrame();
		frm.getContentPane().setLayout(new BorderLayout());
		frm.getContentPane().add(new TransactionButtonPanel(100, 380));
		frm.setSize(100,380);
		frm.setVisible(true);
	}	

}
